package com.fhz.day013jetpackall.di;

import android.content.Context;

import com.fhz.day013jetpackall.dao.BannerDao;
import com.fhz.day013jetpackall.utils.MyDatabase;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import dagger.hilt.InstallIn;
import dagger.hilt.android.qualifiers.ApplicationContext;
import dagger.hilt.components.SingletonComponent;

/**
 * 时间:2022/5/31
 *
 * @author msfeng
 * 简述: TODO
 */
@Module
@InstallIn(SingletonComponent.class)
public class BannerModule {

    @Singleton
    @Provides
    public MyDatabase getMyDatabase(@ApplicationContext Context context){
        return MyDatabase.getMyDatabase(context);
    }

    @Provides
    public BannerDao getBannerDao(MyDatabase myDatabase){
        return myDatabase.bannerDao();
    }

}

